import type { FC, ReactNode } from "react";
import Helmet from "react-helmet";
interface propsType {
  title?: string;
  description?: string;
  keyword?: string[];
  children?: ReactNode;
}
/**
 * head组件
 * @params title {string|undefined} 标题
 * @params description {string|undefined} description介绍
 * @params keyword {string[]|undefined} 关键词
 * @params children {ReactNode|undefined} 额外在head中添加标签
 */
const Head: FC<propsType> = props => {
  return (
    <Helmet>
      {props.title && <title>{props.title}</title>}
      {props.description && <meta name="description" content={props.description} />}
      {props.keyword && <meta name="keyword" content={props.keyword.join(",")} />}
      {props.children}
    </Helmet>
  );
};
export default Head;
